﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DienDanNhaDat.aspx.cs" Inherits="WebHousingInfo.DienDanNhaDat" %>
<%@ Register Src="~/Controls/Header.ascx" TagName="HD" TagPrefix="Header" %>
<%@ Register Src="~/Controls/MenuFooter.ascx" TagName="MN" TagPrefix="MenuFooter" %>
<%@ Register Src="~/Controls/Footer.ascx" TagName="FT" TagPrefix="Footer" %>
<%@ Register Src="~/Controls/NoiThat.ascx" TagName="NT" TagPrefix="NoiThat" %>
<%@ Register Src="~/Controls/DanhMucNhaChoThue.ascx" TagName="CT" TagPrefix="DanhMucNhaChoThue" %>
<%@ Register Src="~/Controls/TimKiem_DienDan.ascx" TagName="TK" TagPrefix="TimKiem" %>
<%@ Register Src="~/Controls/KhongGianSong.ascx" TagName="KGS" TagPrefix="KGSong" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Diễn đàn nhà đất</title>
</head>
<body>
    <form id="form1" runat="server">
    <div id="uni_wrapper">
        <Header:HD ID="Header" runat="server" />
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>     
        <% int soluong = Convert.ToInt32(dlsoluong.SelectedValue);%>   
        <div id="uni_main">
             <div id="content" class="clearfix">             
		        <div id="group_750_l">
		            <div class="box02_top"></div>		
		            <div class="box02_title">
					    <table cellspacing="5" cellpadding="1" border="0">
						    <tr valign="bottom">
    							
							    <td><a href="#">
								    <img border="0" alt="Go Back" src="Images/navbits_start.gif" title="Go Back"></a>
							    </td>
							    <td>&nbsp;</td>
							    <td width="100%">
								    <span class="navbar"><a accesskey="1" href="DienDanNhaDat.aspx">Diễn đàn nhà đất</a></span>    
							    </td>
						    </tr>
					    </table>

				    </div>	 
				    <TimKiem:TK ID="TimKiem" runat="server" />     	
        			<div align="right" class="tcat"> 
                        <span style="margin-right:77%;">Top <%=soluong %> Bài viết mới</span>
                         <asp:DropDownList ID="dlsoluong" AutoPostBack="true" Width="50px" runat="server">
                             <asp:ListItem Value="10">10</asp:ListItem>
                             <asp:ListItem Value="20">20</asp:ListItem>
                             <asp:ListItem Value="30">30</asp:ListItem>
                             <asp:ListItem Value="40">40</asp:ListItem>
                             <asp:ListItem Value="50">50</asp:ListItem>
                         </asp:DropDownList>
        			</div>
        			<% var objectforumnews = HousingInfo.Library.ForumNewsBOList.GetForumNewsBOList_ByNumber(soluong); %>
			        <div id="ketquatimkiem" class="clearfix">	
				        <div class="mainbox_dd">
					        <table cellspacing="0" cellpadding="0" border="0" width="100%">
						        <tbody>
							        <tr valign="top" >
								        <td background="Images/listbg.gif" width="100%" class="tdlistbox">												
									        <div style="display: block;" id="vietvbb_topstats_t_content">
									        <% foreach (var objectdetail in objectforumnews)
                                            { %>
										        <div class="smallfont">
											        <em class="smallfontem">
												        <a title="<%=objectdetail.UserName %>" href="ThanhVienDienDan.aspx?iduser=<%=objectdetail.UserName %>">
												        <font color="black"><%=objectdetail.UserName %></font>
												        </a>
											        </em>
											        <span class="smallfontspan">												        
												        <img border="0" src="Images/new.gif"/>&nbsp;
												        <a href="DienDanBinhLuan.aspx?categoryid=<%=objectdetail.SubTopicForumID%>&id=<%=objectdetail.ForumNewID %>">
												        <%=objectdetail.Title %>
												        </a>
											        </span>
										        </div>
										        <%} %>
									        </div>
								        </td>
								        <td background="Images/listbg.gif" width="20" class="footerlistboxdd">&nbsp;</td>
							        </tr>
						        </tbody>
					        </table>
				        </div>
			        </div>
			        <div id="ketquatimkiem" class="clearfix">
			        <table cellspacing="1" cellpadding="4" border="0" class="tborder">
					        <thead>
						        <tr align="center">
						          <td class="tcat">&nbsp;</td>
						          <td width="484" class="tcat">Diễn đàn</td>
						          <td width="200" class="tcat">Bài mới</td>
						          <td width="55" class="tcat">Ðề tài</td>
						          <td width="60" class="tcat">Bài gởi</td>
        						  
						        </tr>
					        </thead>
					        <% var objectCategory = HousingInfo.Library.CategoryBOList.GetCategoryBOList_ByType(false,true,false,false,true);
                                foreach (var objectCategory_Detail in objectCategory)
                                {%>                                
					        <tbody>
					       
						        <tr>
							        <td colspan="5" class="theadtitledd">						
								        <font size="3"><b style="color: white;"> <%=objectCategory_Detail.CategoryName %> </b></font>			
							        </td>
						        </tr>
					        </tbody>
					        <tbody>					        
					        <%
                                var objectSubTopic = HousingInfo.Library.SubTopicForumBOList.GetSubTopicForumBOList_ByID(objectCategory_Detail.CategoryID);
                                foreach (var objectSubTopic_Detail in objectSubTopic)
                                {%>
                                   
						        <tr align="center">
							        <td class="trcategory">
								        <img border="0" width="25px" height="25px" id="forum_statusicon_2" alt="" src="Image/cottage.ico">
							        </td>
							        <td align="left" id="f2" class="trcategory">
								        <div><a href="DienDanTinTheoChuDe.aspx?idsub=<%=objectSubTopic_Detail.SubTopicForumID %>"><strong><%=objectSubTopic_Detail.SubTopicForumName %></strong></a>			</div>
								        <div><%=objectSubTopic_Detail.SubTopicDescription %></div>
							        </td>							        
							        <td class="trcategory">
								        <div align="left">
								            <% var objectForumBO = HousingInfo.Library.ForumNewsBOList.GetOneForumNews_ByIDSubTopic(objectSubTopic_Detail.SubTopicForumID);%>
							                     <% foreach (var objectForumBo_Detail in objectForumBO)
                                                 {%>
									        <div>
										        <span>										        
											        <img border="0" alt="" src="Images/icon1.gif" class="inlineimg">				
											        <a href="DienDanBinhLuan.aspx?categoryid=<%=objectForumBo_Detail.SubTopicForumID%>&id=<%=objectForumBo_Detail.ForumNewID %>"><strong><%=objectForumBo_Detail.Title %></strong></a>
										        </span>
									        &nbsp;&nbsp;&nbsp;&nbsp;</div>
									        <div>
										        bởi <a href="ThanhVienDienDan.aspx?iduser=<%=objectForumBo_Detail.UserName %>"><%=objectForumBo_Detail.UserName%></a>
									        </div>
									        <div align="right">
										        ngày đăng <span class="time"><%=Convert.ToDateTime(objectForumBo_Detail.CreatedDate).ToString("dd/MM/yyyy")%></span>
									        </div>
									        <%} %>
								        </div>
							        </td>
							        <% int total = HousingInfo.Library.ForumNewsBOList.CountTotalForumNews_BySubID(objectSubTopic_Detail.SubTopicForumID); %>
							        <td class="trcategory"><%=total %></td>
							        <% objectForumBO = HousingInfo.Library.ForumNewsBOList.GetAllForumNews_ByIDSubTopic(objectSubTopic_Detail.SubTopicForumID);
                                    int total_comment=0;  
                                    foreach (var objectDeTail in objectForumBO)
                                      {
                                          total_comment += HousingInfo.Library.ForumCommentBOList.CountTotalForumNews_BySubID(objectDeTail.ForumNewID);
                                      }
                                     %>
							        <td class="trcategory"><%=total+total_comment %></td>
        							
						        </tr>						        					       
                                <%}%>
                                </tbody>
                                <%}       
					        %>					        
				        </table>
			        </div>					
			        <div id="link">
				        <ul>
					        <li class="disable_link"><a>&laquo; Trở về</a></li>
					        <li class="select"><a>1</a></li>
					        <li><a href="#"><strong>2</strong></a></li>
				        </ul>
			        </div>
		        </div>
		        <div id="group_5">
			        <DanhMucNhaChoThue:CT ID="DanhMucNhaChoThue" runat="server" />
			        <NoiThat:NT ID="NoiThat" runat="server" />
			        <KGSong:KGS ID="KGSong" runat="server" />
		        </div>
             </div>
        </div>
        </ContentTemplate>
        </asp:UpdatePanel>
         <MenuFooter:MN ID="MenuFooter" runat="server" />
         <Footer:FT ID="Footer" runat="server" />
    </div>
    </form>
</body>
</html>
